import request from '@/utils/request'; // 自定义的请求工具

export function getAllUsers() {
    return request({
        url: '/user/all',
        method: 'get'
    });
}

export function addUser(data) {
    return request({
        url: '/register',
        method: 'post',
        data
    });
}

export function updateUser(data) {
    return request({
        url: `/user/${data.userId}`, // 请求 URL 中包含用户 ID
        method: 'put',
        data
    });
}

export function deleteUser(id) {
    return request({
        url: `/user/${id}`,
        method: 'delete'
    });
}

export function getUserById(id) {
    return request({
        url: `/user/${id}`,
        method: 'get'
    });
}


